<?php
declare (strict_types=1);

namespace app\admin\controller;

use app\admin\service\AdminLog as AdminLogService;
use app\admin\validate\CommonValidate;
use app\lib\exception\Common as CommonException;
use think\exception\ValidateException;

class AdminLog extends BaseController
{
    protected $code = 200;
    protected $message = "查询成功";

    public function adminLogList()
    {
        $request = $this->request;
        $request->filter(['trim']);
        $param = $request->param();
        try {
            validate(CommonValidate::class)->scene('admin_log_list')->check($param);
        } catch (ValidateException $e) {
            // 验证失败 输出错误信息
            throw new CommonException(['msg' => $e->getError()]);
        }
        $data = AdminLogService::getList($param);

        return success($this->message, $data, $this->code);
    }

}